package cn.com.bluemoon.daps.system.service;

import cn.com.bluemoon.daps.common.domain.UserInfoHolder;
import cn.com.bluemoon.daps.common.enums.BmStatus;
import cn.com.bluemoon.daps.system.entity.DapSystemBizLine;
import cn.com.bluemoon.daps.system.vo.BizLineDetailResponseVo;
import cn.com.bluemoon.daps.system.vo.BizLineRequestVo;
import cn.com.bluemoon.daps.system.vo.BizLineResponseVo;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;

import javax.annotation.Nullable;
import java.util.List;

/**
 * <p>
 * 系统业务线 服务类
 * </p>
 *
 * @author admin
 * @since 2021-09-23
 */
public interface DapSystemBizLineService extends IService<DapSystemBizLine> {

    default LambdaQueryWrapper<DapSystemBizLine> bmLambdaQuery() {
        return Wrappers.<DapSystemBizLine>lambdaQuery().eq(DapSystemBizLine::getBmStatus, BmStatus.ON);
    }

    /**
     * 新增或者更新业务线
     * 带有校验规则
     */
    DapSystemBizLine saveOrUpdateBizLine(DapSystemBizLine bizLineBo);

    /**
     * 删除业务线
     */
    boolean deleteBizLineById(Integer bizLineId);

    BizLineResponseVo appendUserInfoExtra(BizLineResponseVo bizLineResponseVo);

    /**
     * 新增或者更新业务线
     * 带有校验规则
     * @return 业务线id
     */
    Integer saveOrUpdateBizLine(BizLineRequestVo bizLineRequestVo, Integer bizLineId, UserInfoHolder.UserInfo userInfoOrEmpty);

    List<BizLineDetailResponseVo> findBizLineDetails(@Nullable Integer bizLineId);

    /**
     * 删除业务线与系统管理信息（系统管理员、系统开发者）
     */
    void deleteBizLineDetailByBizLineIdAndSystemId(@Nullable Integer bizLineId, String systemId);
}
